package main;

import java.text.DecimalFormat;
import java.text.NumberFormat;

//Nikolas Wolfe
//4/13/09
//CIS 4930
//Game of Life 2

/* =============================================================================
* Registers statistics for Barrier Generations
*/

public class BarrierStatistics extends Statistics
{
	private NumberFormat formatter = new DecimalFormat("#0.00");
	
	public void registerGenerationStartTimeStamp( int numGeneration, long startTime )
	{
		setStartTime( startTime );
		String s = "Generation " + numGeneration + ": " + "Started at " 
			+ Timestamp.now();
		append( s );
	}
	
	public void registerGenerationStopTimeStamp( int numGeneration, long stopTime )
	{
		setStopTime( stopTime );
		String s = "Generation " + numGeneration + ": " + "Stopped at " 
			+ Timestamp.now() + "\n";
		append( s );
	}
	
	public void calcElapsedTime( int numGeneration )
	{
		String s = "Generation " + numGeneration + " Total Elapsed Time: " 
			+ formatter.format(getElapsedTime()) + getUnits() + "\n\n";
		append( s );
	}
	
	public void calculateAverageTime()
	{
		String s = "Average Barrier Time: " + 
			formatter.format(getAverageExecutionTime()) + getUnits();
		append( s );
	}
}
